// 获取文件夹下的文件
const fs = require('fs');

const readFileList = (path, filesList) => {
    const files = fs.readdirSync(path);
    files.forEach(item => {
        const stat = fs.statSync(path + item);
        if (stat.isDirectory()) {
            // 递归读取文件
            readFileList(`${path + item}/`, filesList);
        } else {
            filesList.push(path + item);
        }
    });

};

const GetFileList = (path) => {
    const filesList = [];
    readFileList(path, filesList);
    return filesList;
};

module.exports = GetFileList;
